package cc.rengu.igas.share.common.util;

/**
 * @author wukefan
 * @version 1.0.0
 * @date 2020/6/22 10:50
 * 核心枚举字段转换
 */
public class CoreTransferUtil {

    public static String certTypeCharToNumber(String coreCertType) {
        //默认身份证
        String transferCertType;
        /**
         * certType
         A转换成01(身份证)
         B、C、K转换成02(军官证)
         I、J转换成03(护照)
         M转换成04(户口薄)
         E、L转换成05(士兵证)
         G转换成06(港澳来往内地通行证)
         H转换成07(台湾同胞来往内地通行证)
         N转换成08(临时身份证)
         O转换成09(外国人居留证)
         D转换成10(警官证)
         F、Z转换成99(其它)
         */
        switch (coreCertType) {
            case ("A"):
                transferCertType = "01";
                break;
            case ("B"):
                transferCertType = "02";
                break;
            case ("C"):
                transferCertType = "02";
                break;
            case ("K"):
                transferCertType = "02";
                break;
            case ("I"):
                transferCertType = "03";
                break;
            case ("J"):
                transferCertType = "03";
                break;
            case ("M"):
                transferCertType = "04";
                break;
            case ("E"):
                transferCertType = "05";
                break;
            case ("L"):
                transferCertType = "05";
                break;
            case ("G"):
                transferCertType = "06";
                break;
            case ("H"):
                transferCertType = "07";
                break;
            case ("N"):
                transferCertType = "08";
                break;
            case ("D"):
                transferCertType = "10";
                break;
            case ("F"):
                transferCertType = "99";
                break;
            case ("Z"):
                transferCertType = "99";
                break;
            default:
                transferCertType = "99";
                break;
        }
        return transferCertType;
    }

    /*
     * 证件类型转换
     */
    public static String certTypeTransfer(String igasCertType) {
        //默认身份证
        String transferCertType;
        /**
         * certType
         * 01-身份证
         * 02-军官证
         * 03-护照
         * 04-户口薄
         * 05-士兵证
         * 06-港澳来往内地通行证
         * 07-台湾同胞来往内地通行证
         * 08-临时身份证
         * 09-外国人居留证
         * 10-警官证
         * 99-其它
         */
        /**
         * transferCertType
         *A - 居民身份证
         *B - 军官证
         *C - 解放军文职干部证
         *D - 警官证
         *E - 解放军士兵证
         *F - 其他批文或证明
         *G - 港澳居民来往内地通行证
         *H - 台湾居民来往大陆通行证
         *I - (外国)护照
         *J - (中国)护照
         *K - 武警文职干部证
         *L - 武警士兵证
         * M - 户口簿
         * N - 对私其他证件
         * O - 居住证
         * Z - 其他
         */
        switch (igasCertType) {
            case ("01"):
                transferCertType = "A";
                break;
            case ("02"):
                transferCertType = "B";
                break;
            case ("03"):
                transferCertType = "J";
                break;
            case ("04"):
                transferCertType = "M";
                break;
            case ("05"):
                transferCertType = "E";
                break;
            case ("06"):
                transferCertType = "G";
                break;
            case ("07"):
                transferCertType = "H";
                break;
            case ("08"):
                transferCertType = "N";
                break;
            case ("09"):
                transferCertType = "I";
                break;
            case ("10"):
                transferCertType = "D";
                break;
            case ("99"):
                transferCertType = "Z";
                break;
            default:
                transferCertType = "A";
                break;

        }

        return transferCertType;
    }


    /**
     * 网银互联付款方账号类型转换
     */
    public static String igas2ibpsAcctTypeTransfer(String igasAcctType) {
        String ibpsAcctType = null;
        /**
         * igas-acctType
         * 00-本行借记账户
         * 01-本行贷记账户
         * 02-本行存折
         * 03-本行内部户
         * 04-本行对公户
         * 10-他行借记账户
         * 11-他行贷记账户
         * 12-他行存折
         * 13-他行内部户
         * 14-他行对公户
         * ibps-acctType
         * AT00：单位银行结算账户
         * AT01：个人借记卡（存折）账户
         * AT02：个人贷记卡账户
         */
        switch (igasAcctType) {
            case "00":
            case "02":
            case "10":
            case "12":
                ibpsAcctType = "AT01";
                break;
            case "03":
            case "04":
            case "13":
            case "14":
                ibpsAcctType = "AT00";
                break;
            case "01":
            case "11":
                ibpsAcctType = "AT02";
                break;
        }
        return ibpsAcctType;
    }

}
